package com.proxy.scanandcheck.common.util;

import java.util.Random;

public class RandomUtil {
	
	public static int getRandomIntNum(int min, int max)
	{
		Random rand = new Random();

		// nextInt is normally exclusive of the top value,
		// so add 1 to make it inclusive
		int randomNum = rand.nextInt(max - min + 1) + min;
		return randomNum;
	}
	
	public static long getRandomLongNum(long min, long max)
	{
		/*long random = 0;
		int x = Integer.MAX_VALUE;//2147483647
        while(true)
        {
            if((random = (long)(Math.random()*max)+1) >= min)
            {
                return random;
            }
        }*/
		Random random = new Random();

		long randomValue = min + (long)(random.nextDouble()*(max - min));
		
		return randomValue;
	}
	
	public static void main(String args [])
	{
		System.out.println(getRandomLongNum(2147483649l,3221225470l));
	}

}
